import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import { Dialog, Toast, Icon, Loading } from 'vant'

import Load from './plugins/load'
import Message from './plugins/message'
import { Global } from './assets/js/mixin.js'
import { get, post, gets, posts } from './assets/service/http'
import { move } from './assets/js/utils'
import VueLazyLoad from 'vue-lazyload'
import 'animate.css'

import './assets/js/flex.js'
import watermark from './assets/js/watermark.js'
import './assets/icons/index.js'

// require('./assets/mock')

// 开发模式启用
// if (process.env.NODE_ENV === 'development') {
// const VConsole = require('vconsole')
// let vConsole = new VConsole()
// console.log(vConsole.version)
// }

const VueTouch = require('vue-touch')
Vue.use(Dialog)
Vue.use(Toast)
Vue.use(Icon)
Vue.use(Loading)
Vue.prototype.$watermark = watermark

// Dialog.setDefaultOptions({
//   confirmButtonColor: 'rgba(231, 36, 38, 1)'
// })
// 添加自定义全局插件
Vue.use(Load)
Vue.use(Message)

Vue.mixin(Global)

Vue.use(VueTouch, {
  name: 'v-touch'
})

Vue.use(VueLazyLoad, {
  error: require('./assets/img/loading.gif'),
  loading: require('./assets/img/loading.gif'),
  attempt: 1
})

Vue.prototype.$get = get
Vue.prototype.$post = post
Vue.prototype.$gets = gets
Vue.prototype.$posts = posts

window.eventBus = new Vue({ mixins: [Global] })

window.__axiosPromiseArr = []

Vue.config.productionTip = false

Array.prototype.move = move // eslint-disable-line

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
